package com.hyl.utils;

import com.hyl.arrowSummary.*;
import com.hyl.basicShape.*;
import com.hyl.flowChart.*;
import com.hyl.flowChart.Process;
import com.hyl.formulaShape.*;
import com.hyl.line.*;
import com.hyl.rectangle.*;
import com.hyl.starsAndFlags.*;
import com.hyl.tagging.*;

import java.util.Scanner;

/**
 * @description:
 * @author: molar
 * @date: Created in 2020/6/7 10:46
 * @version:
 * @modified By:
 */
public class Scence {

    public Point setPoints(String a) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入" + a + "点的x坐标：");
        int p0x = scanner.nextInt();
        System.out.print("请输入" + a + "点的y坐标：");
        int p0y = scanner.nextInt();

        Point point = new Point();
        point.setX(p0x);
        point.setY(p0y);
        return point;
    }

    public void action() {
        for (int i = 0; ; i++) {
            UI ui = new UI();
            Scanner scanner = new Scanner(System.in);
            ui.SelectType();
            int choice1 = scanner.nextInt();

            if (choice1 == 1) {
                for (int j1 = 0; ; j1++) {
                    ui.SelectLine();
                    int choice2 = scanner.nextInt();
                    if (choice2 == 1) {
                        ui.position();
                        StraightLine straightLine = new StraightLine(this.setPoints("第1个"), this.setPoints("第2个"));
                        straightLine.drawElement();
                    } else if (choice2 == 2) {
                        ui.position();
                        Arrow arrow = new Arrow(this.setPoints("第1个"), this.setPoints("第2个"));
                        arrow.drawElement();
                    } else if (choice2 == 3) {
                        ui.position();
                        DoubleArrow doubleArrow = new DoubleArrow(this.setPoints("第1个"), this.setPoints("第2个"));
                        doubleArrow.drawElement();
                    } else if (choice2 == 4) {
                        ui.position();
                        ElbowConnector elbowConnector = new ElbowConnector(this.setPoints("第1个"), this.setPoints("第2个"));
                        elbowConnector.drawElement();
                    } else if (choice2 == 5) {
                        ui.position();
                        ElbowArrowConnector elbowArrowConnector = new ElbowArrowConnector(this.setPoints("第1个"), this.setPoints("第2个"));
                        elbowArrowConnector.drawElement();
                    } else if (choice2 == 6) {
                        ui.position();
                        ElbowDoubleArrowConnector elbowDoubleArrowConnector = new ElbowDoubleArrowConnector(this.setPoints("第1个"), this.setPoints("第2个"));
                        elbowDoubleArrowConnector.drawElement();
                    } else if (choice2 == 7) {
                        ui.position();
                        CurveConnector curveConnector = new CurveConnector(this.setPoints("第1个"), this.setPoints("第2个"));
                        curveConnector.drawElement();
                    } else if (choice2 == 8) {
                        ui.position();
                        CurveArrowConnector curveArrowConnector = new CurveArrowConnector(this.setPoints("第1个"), this.setPoints("第2个"));
                        curveArrowConnector.drawElement();
                    } else if (choice2 == 9) {
                        break;
                    } else {
                        ui.error();
                    }
                }
            } else if (choice1 == 2) {
                for (int j2 = 0; ; j2++) {
                    ui.SelectRectangle();
                    int chioce2 = scanner.nextInt();
                    if (chioce2 == 1) {
                        ui.position();
                        Rectangle rectangle = new Rectangle(this.setPoints("中心"));
                        rectangle.drawElement();
                    } else if (chioce2 == 2) {
                        ui.position();
                        RoundedRectangle roundedRectangle = new RoundedRectangle(this.setPoints("中心"));
                        roundedRectangle.drawElement();
                    } else if (chioce2 == 3) {
                        ui.position();
                        RectangleWithSingleCornerCut rectangleWithSingleCornerCut = new RectangleWithSingleCornerCut(this.setPoints("中心"));
                        rectangleWithSingleCornerCut.drawElement();
                    } else if (chioce2 == 4) {
                        ui.position();
                        RectangleWithSameSideCornerCut rectangleWithSameSideCornerCut = new RectangleWithSameSideCornerCut(this.setPoints("中心"));
                        rectangleWithSameSideCornerCut.drawElement();
                    } else if (chioce2 == 5) {
                        ui.position();
                        CutOutTheDiagonalRectangle cutOutTheDiagonalRectangle = new CutOutTheDiagonalRectangle(this.setPoints("中心"));
                        cutOutTheDiagonalRectangle.drawElement();
                    } else if (chioce2 == 6) {
                        ui.position();
                        RectangleWithSingleCornerCut1 rectangleWithSingleCornerCut1 = new RectangleWithSingleCornerCut1(this.setPoints("中心"));
                        rectangleWithSingleCornerCut1.drawElement();
                    } else if (chioce2 == 7) {
                        ui.position();
                        RectangleWithSingleCornerCut2 rectangleWithSingleCornerCut2 = new RectangleWithSingleCornerCut2(this.setPoints("中心"));
                        rectangleWithSingleCornerCut2.drawElement();
                    } else if (chioce2 == 8) {
                        ui.position();
                        RectangleWithSameSideCorner rectangleWithSameSideCorner = new RectangleWithSameSideCorner(this.setPoints("中心"));
                        rectangleWithSameSideCorner.drawElement();
                    } else if (chioce2 == 9) {
                        break;
                    } else {
                        ui.error();
                    }
                }
            } else if (choice1 == 3) {
                for (int j3 = 0; ; j3++) {
                    ui.SelectBasicShape();
                    int chioce2 = scanner.nextInt();
                    if (chioce2 == 1) {
                        ui.position();
                        TextBox textBox = new TextBox(this.setPoints("中心"));
                        textBox.drawElement();
                    } else if (chioce2 == 2) {
                        ui.position();
                        VerticalTextBox verticalTextBox = new VerticalTextBox(this.setPoints("中心"));
                        verticalTextBox.drawElement();
                    } else if (chioce2 == 3) {
                        ui.position();
                        Ellipse ellipse = new Ellipse(this.setPoints("中心"));
                        ellipse.drawElement();
                    } else if (chioce2 == 4) {
                        ui.position();
                        IsoscelesTriangle isoscelesTriangle = new IsoscelesTriangle(this.setPoints("中心"));
                        isoscelesTriangle.drawElement();
                    } else if (chioce2 == 5) {
                        ui.position();
                        RightTriangle rightTriangle = new RightTriangle(this.setPoints("中心"));
                        rightTriangle.drawElement();
                    } else if (chioce2 == 6) {
                        ui.position();
                        Parallelogram parallelogram = new Parallelogram(this.setPoints("中心"));
                        parallelogram.drawElement();
                    } else if (chioce2 == 7) {
                        ui.position();
                        Trapezoid trapezoid = new Trapezoid(this.setPoints("中心"));
                        trapezoid.drawElement();
                    } else if (chioce2 == 8) {
                        ui.position();
                        Rhombus rhombus = new Rhombus(this.setPoints("中心"));
                        rhombus.drawElement();
                    } else if (chioce2 == 9) {
                        break;
                    } else {
                        ui.error();
                    }
                }
            } else if (choice1 == 4) {
                for (int j3 = 0; ; j3++) {
                    ui.SelectArrowSummary();
                    int chioce2 = scanner.nextInt();
                    if (chioce2 == 1) {
                        ui.position();
                        RightArrow rightArrow = new RightArrow(this.setPoints("第一个"), this.setPoints("第二个"));
                        rightArrow.drawElement();
                    } else if (chioce2 == 2) {
                        ui.position();
                        LeftArrow leftArrow = new LeftArrow(this.setPoints("第一个"), this.setPoints("第二个"));
                        leftArrow.drawElement();
                    } else if (chioce2 == 3) {
                        ui.position();
                        UpAndDownArrow upAndDownArrow = new UpAndDownArrow(this.setPoints("第一个"), this.setPoints("第二个"));
                        upAndDownArrow.drawElement();
                    } else if (chioce2 == 4) {
                        ui.position();
                        DownArrow downArrow = new DownArrow(this.setPoints("第一个"), this.setPoints("第二个"));
                        downArrow.drawElement();
                    } else if (chioce2 == 5) {
                        ui.position();
                        LeftAndRightArrow leftAndRightArrow = new LeftAndRightArrow(this.setPoints("第一个"), this.setPoints("第二个"));
                        leftAndRightArrow.drawElement();
                    } else if (chioce2 == 6) {
                        ui.position();
                        UpAndDownArrow upAndDownArrow = new UpAndDownArrow(this.setPoints("第一个"), this.setPoints("第二个"));
                        upAndDownArrow.drawElement();
                    } else if (chioce2 == 7) {
                        ui.position();
                        CrossArrow crossArrow = new CrossArrow(this.setPoints("中心"));
                        crossArrow.drawElement();
                    } else if (chioce2 == 8) {
                        ui.position();
                        TShapedArrow tShapedArrow = new TShapedArrow(this.setPoints("第一个"), this.setPoints("第二个"));
                        tShapedArrow.drawElement();
                    } else if (chioce2 == 9) {
                        break;
                    } else {
                        ui.error();
                    }
                }
            } else if (choice1 == 5) {
                for (int j3 = 0; ; j3++) {
                    ui.SelectFormulaShape();
                    int chioce2 = scanner.nextInt();
                    if (chioce2 == 1) {
                        ui.position();
                        PlusSign plusSign = new PlusSign(this.setPoints("中心"));
                        plusSign.drawElement();
                    } else if (chioce2 == 2) {
                        ui.position();
                        MinusSign minusSign = new MinusSign(this.setPoints("中心"));
                        minusSign.drawElement();
                    } else if (chioce2 == 3) {
                        ui.position();
                        MultiplicationSign multiplicationSign = new MultiplicationSign(this.setPoints("中心"));
                        multiplicationSign.drawElement();
                    } else if (chioce2 == 4) {
                        ui.position();
                        DivisionSign divisionSign = new DivisionSign(this.setPoints("中心"));
                        divisionSign.drawElement();
                    } else if (chioce2 == 5) {
                        ui.position();
                        EqualSign equalSign = new EqualSign(this.setPoints("中心"));
                        equalSign.drawElement();
                    } else if (chioce2 == 6) {
                        ui.position();
                        NotEqualSign equalSign = new NotEqualSign(this.setPoints("中心"));
                        equalSign.drawElement();
                    } else if (chioce2 == 7) {
                        break;
                    } else {
                        ui.error();
                    }
                }
            } else if (choice1 == 6) {
                for (int j3 = 0; ; j3++) {
                    ui.SelectFlowChart();
                    int chioce2 = scanner.nextInt();
                    if (chioce2 == 1) {
                        ui.position();
                        Process process = new Process(this.setPoints("中心"));
                        process.drawElement();
                    } else if (chioce2 == 2) {
                        ui.position();
                        OptionalProcess optionalProcess = new OptionalProcess(this.setPoints("中心"));
                        optionalProcess.drawElement();
                    } else if (chioce2 == 3) {
                        ui.position();
                        Decision decision = new Decision(this.setPoints("中心"));
                        decision.drawElement();
                    } else if (chioce2 == 4) {
                        ui.position();
                        Datas datas = new Datas(this.setPoints("中心"));
                        datas.drawElement();
                    } else if (chioce2 == 5) {
                        ui.position();
                        PredefinedProcess predefinedProcess = new PredefinedProcess(this.setPoints("中心"));
                        predefinedProcess.drawElement();
                    } else if (chioce2 == 6) {
                        ui.position();
                        InternalStorage internalStorage = new InternalStorage(this.setPoints("中心"));
                        internalStorage.drawElement();
                    } else if (chioce2 == 7) {
                        ui.position();
                        Document document = new Document(this.setPoints("中心"));
                        document.drawElement();
                    } else if (chioce2 == 8) {
                        ui.position();
                        MultiDocument multiDocument = new MultiDocument(this.setPoints("中心"));
                        multiDocument.drawElement();
                    } else if (chioce2 == 9) {
                        break;
                    } else {
                        ui.error();
                    }
                }
            } else if (choice1 == 7) {
                for (int j3 = 0; ; j3++) {
                    ui.SelectStarsAndFlags();
                    int chioce2 = scanner.nextInt();
                    if (chioce2 == 1) {
                        ui.position();
                        ExplosiveShape1 explosiveShape1 = new ExplosiveShape1(this.setPoints("中心"));
                        explosiveShape1.drawElement();
                    } else if (chioce2 == 2) {
                        ui.position();
                        ExplosiveShape2 explosiveShape2 = new ExplosiveShape2(this.setPoints("中心"));
                        explosiveShape2.drawElement();
                    } else if (chioce2 == 3) {
                        ui.position();
                        CrossStar crossStar = new CrossStar(this.setPoints("中心"));
                        crossStar.drawElement();
                    } else if (chioce2 == 4) {
                        ui.position();
                        PentagramStar pentagramStar = new PentagramStar(this.setPoints("中心"));
                        pentagramStar.drawElement();
                    } else if (chioce2 == 5) {
                        ui.position();
                        HexagonStar hexagonStar = new HexagonStar(this.setPoints("中心"));
                        hexagonStar.drawElement();
                    } else if (chioce2 == 6) {
                        ui.position();
                        SevenPointStar sevenPointStar = new SevenPointStar(this.setPoints("中心"));
                        sevenPointStar.drawElement();
                    } else if (chioce2 == 7) {
                        ui.position();
                        OctagonalStar octagonalStar = new OctagonalStar(this.setPoints("中心"));
                        octagonalStar.drawElement();
                    } else if (chioce2 == 8) {
                        ui.position();
                        DecagonalStar decagonalStar = new DecagonalStar(this.setPoints("中心"));
                        decagonalStar.drawElement();
                    } else if (chioce2 == 9) {
                        break;
                    } else {
                        ui.error();
                    }
                }
            } else if (choice1 == 8) {
                for (int j3 = 0; ; j3++) {
                    ui.SelectTagging();
                    int chioce2 = scanner.nextInt();
                    if (chioce2 == 1) {
                        ui.position();
                        RectangleDimension rectangleDimension = new RectangleDimension(this.setPoints("中心"));
                        rectangleDimension.drawElement();
                    } else if (chioce2 == 2) {
                        ui.position();
                        RoundedRectangleDimension roundedRectangleDimension = new RoundedRectangleDimension(this.setPoints("中心"));
                        roundedRectangleDimension.drawElement();
                    } else if (chioce2 == 3) {
                        ui.position();
                        EllipseDimension ellipseDimension = new EllipseDimension(this.setPoints("中心"));
                        ellipseDimension.drawElement();
                    } else if (chioce2 == 4) {
                        ui.position();
                        CloudDimension cloudDimension = new CloudDimension(this.setPoints("中心"));
                        cloudDimension.drawElement();
                    } else if (chioce2 == 5) {
                        ui.position();
                        LinearDimension1 linearDimension1 = new LinearDimension1(this.setPoints("中心"));
                        linearDimension1.drawElement();
                    } else if (chioce2 == 6) {
                        ui.position();
                        LinearDimension2 linearDimension2 = new LinearDimension2(this.setPoints("中心"));
                        linearDimension2.drawElement();
                    } else if (chioce2 == 7) {
                        ui.position();
                        LinearDimension3 linearDimension3 = new LinearDimension3(this.setPoints("中心"));
                        linearDimension3.drawElement();
                    } else if (chioce2 == 8) {
                        ui.position();
                        LinearDimensionStrong1 linearDimensionStrong1 = new LinearDimensionStrong1(this.setPoints("中心"));
                        linearDimensionStrong1.drawElement();
                    } else if (chioce2 == 9) {
                        break;
                    } else {
                        ui.error();
                    }
                }
            } else if (choice1 == 9) {
                ui.end();
                break;
            } else {
                ui.error();
            }
        }
    }

}
